home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 15 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.4 KB  |  48 lines

  1. Newsgroups: comp.std.c
  2. Path: netcom.com!ahicks
  3. From: ahicks@netcom.com (Aaron Hicks at Netcom)
  4. Subject: static and extern, and a variable be both ?
  5. Message-ID: <ahicksDKMG56.K20@netcom.com>
  6. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  7. Date: Wed, 3 Jan 1996 20:12:42 GMT
  8. Sender: ahicks@netcom3.netcom.com
  9.  
  10. Folks,
  11.   
  12.  
  13.    After much looking and little finding I have come to ask for your 
  14. assistance.  I'm working on a project in which we believed the best way
  15. to insure a 500K array was allocated corectly was to declare it as static  
  16. and then when we needed to use it in a nother program to declare it there as 
  17. an extern.  When we did this we got a variable undefined error during the
  18. linking of the programs.  Now my question is this a standard C compiler 
  19. thing or is this compiler wrong.  Below are the relative parts of the code:
  20.  
  21. common.h
  22. ...
  23. typedef char Bit_Fail_Array_Type[Row_Max][Column_Max_By_Byte][Sub_Array_Max];
  24. ...
  25.  
  26. raster.c 
  27. ...
  28. static Bit_Fail_Array_Type bit_fail_array_table;
  29. ... 
  30.  
  31. raster_anaylsis.c
  32. ...
  33. extern Bit_Fail_Array_Type bit_fail_array_table;
  34. ...
  35.  
  36.  
  37. I have found that this will work if I just do not declare the array as 
  38. a static in the first place.  It then will work fine, but we a slightly 
  39. afraid that if we do not declare this as static when it is declared there
  40. may not be enough memory left after the other parts of this program have 
  41. ran of a while.
  42.  
  43.  
  44. Thanks in Advance
  45.  
  46. Aaron Hicks
  47. ahicks@netcom.com
  48.